package com.nisum.mocksimulator.webservice;

import javax.xml.ws.Endpoint;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Component;

@Component
public class CarWebServicePublisher {
  @Autowired
  CarWebServiceImpl carWebService;
	
  public static void main(String[] args) {
		@SuppressWarnings("resource")
		ApplicationContext ctx = new ClassPathXmlApplicationContext(
				"com/nisum/mocksimulator/config/webservicecontext.xml");
		CarWebServicePublisher cwsp = ctx.getBean(CarWebServicePublisher.class);
		cwsp.publish();
  }
  
  private void publish() {
	  System.out.print("WebService being published... ");
	  Endpoint.publish("http://localhost:9191/ws/car", carWebService);
	  System.out.println("Done");
  }
}